<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>角色分配--博客后台管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<!--1.09的layjs不兼容，引入它自带的-->
	<link rel="stylesheet" href="../../../plugin/transfer/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="../../../plugin/transfer/css/cyType.css" media="all">
	<link rel="stylesheet" href="../../../plugin/transfer/css/cyStyle.css" media="all">
	<link rel="stylesheet" href="../../../plugin/transfer/css/font-awesome.min.css" media="all">

</head>
<body class="childrenBody">
	<form class="layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label">角色名称</label>
			<div class="layui-input-block">
				<div class="layui-input-normal layui-form">
					<div cyType="transferTool" cyProps="url:'/role/selectAllAdmin.do'"  name="ids[]" value=""></div>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="submitForm">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		</div>

	</form>
	<!--1.09的layjs不兼容，引入它自带的-->
	<script src="../../../plugin/transfer/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../plugin/transfer/js/jquery-1.10.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../plugin/transfer/js/utils.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../plugin/transfer/js/transferTool.js" type="text/javascript" charset="utf-8"></script>

	<script>
		layui.use(['form','layer'], function () {
			var form = layui.form,
			layer = parent.layer === undefined ? layui.layer : parent.layer;
			//监听提交
			//获取页面的roleId
			var roleId = location.href.substr(location.href.lastIndexOf("#")+1);
			form.on('submit(submitForm)', function (data) {
				var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
				var ids="";
				if(data.field.ids){
					ids=data.field.ids.toString();
				}
				$.get("/role/saveAdminIntoCurrentRole.do?id="+roleId+"&ids="+ids,function(returnData){
					top.layer.close(index);
					top.layer.msg("分配成功！");
					layer.closeAll("iframe");
					//刷新父页面
					parent.location.reload();
				});
				return false;
			});
		});
	</script>
</body>
</html>